class Solution(object):
    def numTimesAllBlue(self, flips):
        n = len(flips)
        now_max = 0
        ans = 0
        for i in range(n):
            now_max = max(flips[i], now_max)
            if now_max == i + 1:
                ans += 1
        return ans